/*	PureMVC AS3 / Flex Demo - Slacker 
	Copyright (c) 2008 Clifford Hall <clifford.hall@puremvc.org>
	Your reuse is governed by the Creative Commons Attribution 3.0 License */
package mvc.view
{
	import com.tools.traceTool.TraceTool;
	
	import components.DefaultView;
	
	import flash.events.Event;
	
	import mx.events.FlexEvent;
	
	import org.puremvc.as3.patterns.mediator.Mediator;

	public class DefaultViewMediator extends Mediator
	{
        public static const NAME:String = 'DefaultViewMediator';
		private static var hasHideEventListener:Boolean=false;
        public function DefaultViewMediator(viewComponent:Object)
        {
        	Trace("		START	constructor	"+this);
        	super(NAME,viewComponent);
        	Trace("		FINISH	constructor	"+this+'	'+defaultView);
        }
		private	function Trace(...args):void{TraceTool.send('gTrace', String(Object(this).constructor), args);}
		override public function onRemove():void{Trace("#	onRemove	");super.onRemove();}
		override public function onRegister():void
		{
			Trace("#	onRegister	addEventListener	"+defaultView);
			hasHideEventListener?null:defaultView.addEventListener(FlexEvent.HIDE, onHide);
			hasHideEventListener?null:defaultView.addEventListener(FlexEvent.SHOW, onShow);
			hasHideEventListener=true;
		}
		protected function onHide(event:Event):void{Trace("#	onHide");}   
		protected function onShow(event:Event):void{Trace("#	onShow"); ArtGConfig.setTextAreaMsg();}   
        protected function get defaultView():DefaultView{return DefaultView(viewComponent);}
	}
}